﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Service.Core;
using Service.Core.Interface;
using Service.Core.Result;
using Web.BML.AnalysisData;
using Web.BML.CoreData;
using Web.Models.AnalysisData;
using Web.Models.CoreData;

namespace Web.Service
{
    public  class ReportAnalysisService : BaseService
    {
        private  ReportAnalysisOp reportAnalysisOp = ReportAnalysisOp.GetInstance();
        private UserOp userOp = UserOp.GetInstance();

        private CompanyOp companyOp = CompanyOp.GetInstance();

        private static ReportAnalysisService instance;

        private ReportAnalysisService()
        {

        }

        public static ReportAnalysisService GetInstance()
        {
            if (instance == null)
            {
                instance = new ReportAnalysisService();
            }
            return instance;
        }

        /// <summary>
        /// 根据用户许可号读取报文列表数据
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public IServiceResult ReadReportAnalysis(string account)
        {
            User user = userOp.QueryUser(account);
            HttpContext.Current.Session["UserMMSI"] = user.MMSI;
            HttpContext.Current.Session.Timeout = 60;
            List<ReportAnalysis> anaList = reportAnalysisOp.QueryUserReportAnalyses(user.MMSI);
            return Result(ResultType.Success, anaList);
        }

    }
}